package com.yyt;

import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.view.View;

import com.yyt.libsrc.helper.LocalHelper;
import com.yyt.libsrc.router.RouteTable;
import com.yyt.libsrc.router.RouterHelper;

import java.util.concurrent.TimeUnit;

import io.reactivex.Flowable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.functions.Consumer;
import top.lixb.libcommon.base.BaseActivity;

public class WelcomeActivity extends BaseActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        setNoTitle();
        mStatusbar.setVisibility(View.GONE);
        Flowable.timer(2000, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<Long>() {
            @Override
            public void accept(Long aLong) throws Exception {
                if (!TextUtils.isEmpty(LocalHelper.getTicket())) {
                    RouterHelper.getInstance().startAct(RouteTable.main_index);
                }else {
                    RouterHelper.getInstance().startAct(RouteTable.main_login);
                }
                finish();
                overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
            }
        });

    }


}
